import Vue from 'vue'
import App from './App.vue'
import router from './router'
// 引入全局样式
import './assets/css/global.css'
// 导入elementui组件
import './plugins/element.js'

// 引入iconfont样式
import './assets/font/iconfont.css'
// 引入axios
import axios from "axios"
// 导入vue-tree
import TreeTable from 'vue-table-with-tree-grid'
// 关闭开发提示
Vue.config.productionTip = false
// 全局注册组件
Vue.component('tree-table', TreeTable)

// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
//引入样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
// 注册组件
Vue.use(VueQuillEditor)

// 时间过滤器
Vue.filter('dateFormat', function (originval) {
  const dt = new Date(originval)

  const y = dt.getFullYear()
  const m = (dt.getMonth()+1+'').padStart(2,'0')
  const d = (dt.getDate()+'').padStart(2,'0')
  const hh = (dt.getHours()+'').padStart(2,'0')
  const mm = (dt.getMinutes()+'').padStart(2,'0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})

axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
// 配置根路径
axios.defaults.baseURL="http://127.0.0.1:8888/api/private/v1/"
// 原型绑定axios
Vue.prototype.$http = axios
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
